package com.superman.supermarket.client.composite.refundlist;

import java.util.Map;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.superman.supermarket.client.composite.preorder.sku.PreorderSkuModule;
import com.superman.supermarket.client.utils.ActivityJumpUrl;

/**
 * 退款模块
 * 
 * @author superman
 * @version 2018年8月20日下午10:28:32
 */
public class RefundSkuModule extends PreorderSkuModule {

	private String refundId;

	/**
	 * 构造方法
	 * 
	 * @author superman
	 * @version 2018年8月20日 下午10:28:59
	 */
	public RefundSkuModule() {
		skupanel.setWidth("9.6rem");
		skupanel.getElement().getStyle().setProperty("padding", "0.4rem 0rem");
		skupanel.getElement().getStyle().setProperty("background", "#fff");
		// skupanel.getElement().getStyle().setProperty("marginTop", "0.4rem");
		salepricehtml.setVisible(false);
		numhtml.setVisible(false);
		optpanel.removeFromParent();

		skupanel.addDomHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				ActivityJumpUrl.pushToRefundDetailPage(refundId);
			}
		}, ClickEvent.getType());
	}

	@Override
	public void setData(Map<String, Object> map) {
		refundId = String.valueOf(map.get("REFUND_ID"));
		skuimg.setUrl(String.valueOf(map.get("SKU_PIC")));
		skunamehtml.setText(String.valueOf(map.get("SKU_NAME")));
		skupropnameshtml.setText(String.valueOf(map.get("SKU_PROPS_NAME")));

		// if (map.get("OP") != null && XJsonUtil.getOnlyList((JSONArray)
		// map.get("OP")).size() > 0) {
		// optpanel.setVisible(true);
		// List<Object> ops = XJsonUtil.getOnlyList((JSONArray) map.get("OP"));
		// for (Object object : ops) {
		// int op = (int) Double.parseDouble(String.valueOf(object));
		// OrderListOpButton orderListOpButton = new OrderListOpButton(map, op);
		// optpanel.add(orderListOpButton);
		// }
		// }
	}

}
